package com.yehun.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BitOperUtils {

    private static final Logger logger = LoggerFactory.getLogger(BitOperUtils.class);

    public static boolean exists(long value, long tempValue) {
        return ((value & tempValue) == tempValue);
    }

    public static boolean equals(long value, long tempValue) {
        return value == tempValue;
    }

    public static long insert(long value, long tempValue) {
        return value | tempValue;
    }

    public static long remove(long value, long tempValue) {
        return value & ~tempValue;
    }


    public static void main(String[] args) {
        long value = 8589655742L;
        logger.info("value => " + exists(value, 4294967296L));
        value = insert(value, 16);
        logger.info("value => " + value);
        logger.info("isExists => " + exists(value, 8));
        value = remove(value, 4);
        logger.info("value => " + value);
    }



}
